﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using CourseScheduling.DataAccess;

namespace CourseScheduling
{
    public partial class NewCourse : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void addCourse_Click(object sender, EventArgs e)
        {
            try
            {
                SqlDataSource1.InsertParameters["CourseName"].DefaultValue = TextBox1.Text;
                SqlDataSource1.InsertParameters["CourseNumber"].DefaultValue = TextBox2.Text;
                SqlDataSource1.InsertParameters["OddFall"].DefaultValue = CheckBox1.Checked.ToString();
                SqlDataSource1.InsertParameters["EvenSpring"].DefaultValue = CheckBox2.Checked.ToString();
                SqlDataSource1.InsertParameters["EvenFall"].DefaultValue = CheckBox3.Checked.ToString();
                SqlDataSource1.InsertParameters["OddSpring"].DefaultValue = CheckBox4.Checked.ToString();
                SqlDataSource1.Insert();

            }
            catch (Exception ex)
            {
                
            }
            Response.Redirect("EditCatalog.aspx");
        }

        protected void progTrack_Click(object sender, EventArgs e)
        {

            try
            {
                SqlDataSource2.InsertParameters["CourseNumber"].DefaultValue = DropDownList1.SelectedValue;
                SqlDataSource2.InsertParameters["ProgramID"].DefaultValue = DropDownList2.SelectedValue;
                SqlDataSource2.Insert();

            }
            catch (Exception ex)
            {
            }
            Response.Redirect("EditCatalog.aspx");

        }
    }
}